//------------------------------------------------------------------------------
//register definition for sh79f161
// 
//this header can be use for assemble language project developing
//------------------------------------------------------------------------------
//note: define SFR:      D:80h~D:ffh
//------------------------------------------------------------------------------


//------------------------------------------------------------------------0x80~0x87
	sfr		P0			=	0x80;	// 	Standard 8051
	sfr		SP			=	0x81;	// 	Standard 8051
	sfr		DPL			=	0x82;	// 	Standard 8051
	sfr		DPH			=	0x83;	// 	Standard 8051
	sfr		DPL1		=	0x84;	//	79f161
	sfr		DPH1		=	0x85;	//	79f161
	sfr		INSCON		=	0x86;	//	79f161
	sfr		PCON		=	0x87;	// 	Standard 8051	
//------------------------------------------------------------------------0x88~0x8F
	sfr		TCON		=	0x88;	// 	Standard 8051		
	sfr		TMOD		=	0x89;	// 	Standard 8051
	sfr		TL0			=	0x8A;	// 	Standard 8051
	sfr		TL1			=	0x8B;	// 	Standard 8051
	sfr		TH0			=	0x8C;	// 	Standard 8051
	sfr		TH1			=	0x8D;	// 	Standard 8051
	sfr		SUSLO		=	0x8E;	//	79f161
	//sfr				=	0x8F;	//	(Reserved)
//------------------------------------------------------------------------0x90~0x97
	sfr		P1			=	0x90;	// 	Standard 8051
	//sfr				=	0x91;	//	(Reserved)
	//sfr				=	0x92;	//	(Reserved)
	sfr		ADCON		=	0x93;	//	79f161
	sfr		ADT			=	0x94;	//	79f161
	sfr		ADCH		=	0x95;	//	79f161
	sfr		ADDL		=	0x96;	//	79f161
	sfr		ADDH		=	0x97;	//	79f161
//------------------------------------------------------------------------0x98~0x9F
	sfr		SCON		=	0x98;	// 	Standard 8051
	sfr		SBUF		=	0x99;	// 	Standard 8051
	sfr		SADDR		=	0x9A;	//	79f161
	sfr		SADEN		=	0x9B;	//	79f161
	sfr		SCON1		=	0xE8;	// 	Standard 8051
	sfr		SBUF1		=	0x9D;	// 	Standard 8051
	sfr		SADDR1		=	0x9E;	//	79f161
	sfr		SADEN1		=	0x9F;	//	79f161
	sfr		SBRT0		=	0X9C;
	sfr		SBRT1		=	0XA4;
//SCON1		DATA	0E8H
//SBUF1		DATA	9DH
//SADDR1		DATA	9EH
//SADEN1		DATA	9FH
//SBRT0		DATA	9CH
//SBRT1		DATA	0A4H
	//sfr				=	0x9C;	//	(Reserved)
	//sfr				=	0x9D;	//	(Reserved)
	//sfr				=	0x9E;	//	(Reserved)
	//sfr				=	0x9F;	//	(Reserved)
//------------------------------------------------------------------------0xA0~0xA7
	sfr		P2			=	0xA0;	//	Standard 8051
	//sfr				=	0xA1;	//	(Reserved)
	sfr		SPCON		=	0xA2;	//	79f161
	sfr		SPDAT		=	0xA3;	//	79f161
	//sfr				=	0xA4;	//	(Reserved)
	//sfr				=	0xA5;	//	(Reserved)
	//sfr				=	0xA6;	//	(Reserved)
	//sfr				=	0xA7;	//	(Reserved)
//------------------------------------------------------------------------0xA8~0xAF
	sfr		IEN0		=	0xA8;	//	79f161
	sfr		IEN1		=	0xA9;	//	79f161
	//sfr				=	0xAA;	//	(Reserved)
	//sfr				=	0xAB;	//	(Reserved)
	//sfr				=	0xAC;	//	(Reserved)
	//sfr				=	0xAD;	//	(Reserved)
	//sfr				=	0xAE;	//	(Reserved)
	//sfr				=	0xAF;	//	(Reserved)
//------------------------------------------------------------------------0xB0~0xB7
	sfr		P3			=	0xB0;	// 	Standard 8051
	sfr		RSTSTAT		=	0xB1;	//	79f161
	sfr		CLKCON		=	0xB2;	//	79f161                          
	//sfr				=	0xB3;	//	(Reserved)
	sfr		IPH0		=	0xB4;	//	79f161
	sfr		IPH1		=	0xB5;	//	79f161
	//sfr				=	0xB6;	//	(Reserved)
	//sfr				=	0xB7;	//	(Reserved)
//------------------------------------------------------------------------0xB8~0xBF
	sfr		IPL0		=	0xB8;	//	79f161
	sfr		IPL1		=	0xB9;	//	79f161
	sfr		IENC		=	0xBA;	//	79f161
	//sfr				=	0xBB;	//	(Reserved)
	//sfr				=	0xBC;	//	(Reserved)
	sfr		BUZCON		=	0xBD;	//	79f161
	//sfr				=	0xBE;	//	(Reserved)
	//sfr				=	0xBF;	//	(Reserved)
//-------------------------------------------------------------------------0xC0~0xC7
	//sfr				=	0xC0;	//	(Reserved)
	//sfr				=	0xC1;	//	(Reserved)
	//sfr				=	0xC2;	//	(Reserved)
	//sfr				=	0xC3;	//	(Reserved)
	//sfr				=	0xC4;	//	(Reserved)
	//sfr				=	0xC5;	//	(Reserved)
	//sfr				=	0xC6;	//	(Reserved)
	//sfr				=	0xC7;	//	(Reserved)
//-------------------------------------------------------------------------0xC8~0xCF
	sfr		T2CON		=	0xC8;	//	79f161
	sfr		T2MOD		=	0xC9;	//	79f161
	sfr		RCAP2L		=	0xCA;	//	79f161
	sfr		RCAP2H		=	0xCB;	//	79f161
	sfr		TL2			=	0xCC;	//	79f161
	sfr		TH2			=	0xCD;	//	79f161
	sfr		TCOME		=	0xCE;	//	79f161
	sfr		PWMEN		=	0xCF;	//	79f161
//-------------------------------------------------------------------------0xD0~0xD7
	sfr		PSW			=	0xD0;	//	Standard 8051
	//sfr		PWM0DT		=	0xD1;	//	79f161
	//sfr		PWM0C		=	0xD2;	//	79f161
	//sfr		PWM0PL		=	0xD3;	//	79f161
	//sfr		PWM0PH		=	0xD4;	//	79f161
	//sfr		PWM0DL		=	0xD5;	//	79f161
	//sfr		PWM0DH		=	0xD6;	//	79f161
	//sfr		PWM1DT		=	0xD7;	//	79f161
//-------------------------------------------------------------------------0xD8~0xDF
	sfr		EXF1		=	0xD8;	//	79f161
	sfr		PWM0CON	=	0XD9;	
	sfr		PWM1CON	=	0xDA;	//	79f161
	sfr		PWM2CON	=	0xDB;	//	79f161
	sfr		PWM0P		=	0xD1;	//	79f161
	sfr		PWM1P		=	0xD2;	//	79f161
	sfr		PWM2P		=	0xD3;	//	79f161
	sfr		PWM0D		=	0xC1;	//	79f161
	sfr		PWM1D		=	0xC2;	//	79f161
	sfr		PWM2D		=	0xC3;	//	79f161
//-------------------------------------------------------------------------0xE0~0xE7
	sfr		ACC			=	0xE0;	// 	Standard 8051
	sfr		P0CR		=	0xE1;	//	79f161
	sfr		P1CR		=	0xE2;	//	79f161
	sfr		P2CR		=	0xE3;	//	79f161
	sfr		P3CR		=	0xE4;	//	79f161
	//sfr				=	0xE5;	//	(Reserved)
	//sfr				=	0xE6;	//	(Reserved)
	sfr		PWMLO		=	0xE7;	//	79f161
//-------------------------------------------------------------------------0xE8~0xEF


	sfr		EXF0		=	0xaa;	//	79f161
//	sfr		P0PCR		=	0xE9;	//	79f161
	//sfr		P1PCR		=	0xEA;	//	79f161
//	sfr		P2PCR		=	0xEB;	//	79f161
	//sfr		P3PCR		=	0xEC;	//	79f161
	//sfr				=	0xED;	//	(Reserved)
	//sfr				=	0xEE;	//	(Reserved)
	//sfr		P0SS		=	0xEF;	//	79f161
	
//-------------------------------------------------------------------------0xF0~0xF7
	sfr		B			=	0xF0;	// 	Standard 8051
	sfr		C			=	0xF1;	// 	Standard 8051
	sfr		IB_CON1		=	0xF2;	//	79f161
	sfr		IB_CON2		=	0xF3;	//	79f161
	sfr		IB_CON3		=	0xF4;	//	79f161
	sfr		IB_CON4		=	0xF5;	//	79f161
	sfr		IB_CON5		=	0xF6;	//	79f161
	sfr		XPAGE		=	0xF7;	//	79f161
//-------------------------------------------------------------------------0xF8~0xFF
	sfr		SPSTA		=	0xF8;	//	79f161	
	//sfr		IB_CLK0		=	0xF9;	//	79f161
//	sfr		IB_CLK1		=	0xFA;	//	79f161
	sfr		IB_OFFSET	=	0xFB;	//	79f161
	sfr		IB_DATA		=	0xFC;	//	79f161
	//sfr				=	0xFD;	//	(Reserved)
	//sfr				=	0xFE;	//	(Reserved)
	//sfr				=	0xFF;	//	(Reserved)
	sfr		CMPCON0	=	0X91;
	sfr		CMPCON1	=	0X92;
	sfr		LPDCON		=	0XB3;

	sfr		P0M0		=	0XE9;
	sfr		P1M0		=	0XEA;
	sfr		P2M0		=	0XEB;
	sfr		P3M0		=	0XEC;
	sfr		P4M0		=	0XED;
	sfr		P0M1		=	0XE1;
	sfr		P1M1		=	0XE2;
	sfr		P2M1		=	0XE3;
	sfr		P3M1		=	0XE4;
	sfr		P4M1		=	0XE5;


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0x80 bit addressable
	sbit	P0_7		=	P0^7;	// 	Standard 8051
	sbit	P0_6		=	P0^6;	// 	Standard 8051
	sbit	P0_5		=	P0^5;	// 	Standard 8051
	sbit	P0_4		=	P0^4;	// 	Standard 8051
	sbit	P0_3		=	P0^3;	// 	Standard 8051
	sbit	P0_2		=	P0^2;	// 	Standard 8051
	sbit	P0_1		=	P0^1;	// 	Standard 8051
	sbit	P0_0		=	P0^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0x88 bit addressable
	sbit	TF1			=	TCON^7;	// 	Standard 8051
	sbit	TR1			=	TCON^6;	// 	Standard 8051
	sbit	TF0			=	TCON^5;	// 	Standard 8051
	sbit	TR0			=	TCON^4;	// 	Standard 8051
	sbit	IE1			=	TCON^3;	// 	Standard 8051
	sbit	IT1			=	TCON^2;	// 	Standard 8051
	sbit	IE0			=	TCON^1;	// 	Standard 8051
	sbit	IT0			=	TCON^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0x90 bit addressable
	sbit	P1_7		=	P1^7;	// 	Standard 8051
	sbit	P1_6		=	P1^6;	// 	Standard 8051
	sbit	P1_5		=	P1^5;	// 	Standard 8051
	sbit	P1_4		=	P1^4;	// 	Standard 8051
	sbit	P1_3		=	P1^3;	// 	Standard 8051
	sbit	P1_2		=	P1^2;	// 	Standard 8051
	sbit	P1_1		=	P1^1;	// 	Standard 8051
	sbit	P1_0		=	P1^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0x98 bit addressable
	sbit	SM0			=	SCON^7;	// 	Standard 8051
	sbit	SM1			=	SCON^6;	// 	Standard 8051
	sbit	SM2			=	SCON^5;	// 	Standard 8051
	sbit	REN			=	SCON^4;	// 	Standard 8051
	sbit	TB8			=	SCON^3;	// 	Standard 8051
	sbit	RB8			=	SCON^2;	// 	Standard 8051
	sbit	TI			=	SCON^1;	// 	Standard 8051
	sbit	RI			=	SCON^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xA0 bit addressable
	sbit	P2_7		=	P2^7;	// 	Standard 8051
	sbit	P2_6		=	P2^6;	// 	Standard 8051
	sbit	P2_5		=	P2^5;	// 	Standard 8051
	sbit	P2_4		=	P2^4;	// 	Standard 8051
	sbit	P2_3		=	P2^3;	// 	Standard 8051
	sbit	P2_2		=	P2^2;	// 	Standard 8051
	sbit	P2_1		=	P2^1;	// 	Standard 8051
	sbit	P2_0		=	P2^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xA8 bit addressable
	sbit	EA			=	IEN0^7;	// 	Standard 8051
	sbit	EADC		=	IEN0^6;
	sbit	ET2			=	IEN0^5;	
	sbit	ES			=	IEN0^4;	// 	Standard 8051
	sbit	ET1			=	IEN0^3;	// 	Standard 8051
	sbit	EX1			=	IEN0^2;	// 	Standard 8051
	sbit	ET0			=	IEN0^1;	// 	Standard 8051
	sbit	EX0			=	IEN0^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xA9 bit addressable
/*
	sbit	EPLD		=	IEN1^7;	// 	Standard 8051
	sbit	EX4			=	IEN1^6;
	sbit	EPWM		=	IEN1^5;	
	sbit	ESCM		=	IEN1^4;	// 	Standard 8051
	sbit	ECMP1		=	IEN1^3;	// 	Standard 8051
	sbit	ES1			=	IEN1^2;	// 	Standard 8051
	sbit	ECMP0		=	IEN1^1;	// 	Standard 8051
	sbit	ESPI		=	IEN1^0;	// 	Standard 8051*/
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xB0 bit addressable
	sbit	P3_7		=	P3^7;	// 	Standard 8051
	sbit	P3_6		=	P3^6;	// 	Standard 8051
	sbit	P3_5		=	P3^5;	// 	Standard 8051
	sbit	P3_4		=	P3^4;	// 	Standard 8051
	sbit	P3_3		=	P3^3;	// 	Standard 8051
	sbit	P3_2		=	P3^2;	// 	Standard 8051
	sbit	P3_1		=	P3^1;	// 	Standard 8051
	sbit	P3_0		=	P3^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xB8 bit addressable
	//sbit				=	IPL0^7;	//	(Reserved)
	sbit	PADCL		=	IPL0^6;	
	sbit	PT2L		=	IPL0^5;
	sbit	PUL			=	IPL0^4;
	sbit	PT1L		=	IPL0^3;
	sbit	PX1L		=	IPL0^2;
	sbit	PT0L		=	IPL0^1;
	sbit	PX0L		=	IPL0^0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xC0 bit addressable
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)		
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xC8 bit addressable
	sbit	TF2			=	T2CON^7;
	sbit	EXF2		=	T2CON^6;
	sbit	RCLK		=	T2CON^5;
	sbit	TCLK		=	T2CON^4;
	sbit	EXEN2		=	T2CON^3;
	sbit	TR2			=	T2CON^2;
	sbit	CT2			=	T2CON^1;
	sbit	CP2			=	T2CON^0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xD0 bit addressable
	sbit	CY			=	PSW^7;	// 	Standard 8051
	sbit	AC			=	PSW^6;	// 	Standard 8051
	sbit	F0			=	PSW^5;	// 	Standard 8051
	sbit	RS1			=	PSW^4;	// 	Standard 8051
	sbit	RS0			=	PSW^3;	// 	Standard 8051
	sbit	OV			=	PSW^2;	// 	Standard 8051
	sbit	F1			=	PSW^1;
	sbit	P			=	PSW^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xD8 bit addressable
	//sbit				=			//	(Reserved)
	sbit	IF46		=	EXF1^6;	//	(Reserved)
	sbit	IF45		=	EXF1^5;	//	(Reserved)
	//sbit				=			//	(Reserved)
	sbit	IF43		=	EXF1^3;	//	(Reserved)
	sbit	IF42		=	EXF1^2;	//	(Reserved)
	sbit	IF41		=	EXF1^1;	//	(Reserved)
	sbit	IF40		=	EXF1^0;	//	(Reserved)		
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xE0 bit addressable
	sbit	ACC_7		=	ACC^7;	// 	Standard 8051
	sbit	ACC_6		=	ACC^6;	// 	Standard 8051
	sbit	ACC_5		=	ACC^5;	// 	Standard 8051
	sbit	ACC_4		=	ACC^4;	// 	Standard 8051
	sbit	ACC_3		=	ACC^3;	// 	Standard 8051
	sbit	ACC_2		=	ACC^2;	// 	Standard 8051
	sbit	ACC_1		=	ACC^1;	// 	Standard 8051
	sbit	ACC_0		=	ACC^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xE8 bit addressable
	//sbit	IT41		=	EXF0^7;
//	sbit	IT40		=	EXF0^6;
//	sbit	IT31		=	EXF0^5;
//	sbit	IT30		=	EXF0^4;
//	sbit	IT21		=	EXF0^3;
//	sbit	IT20		=	EXF0^2;
//	sbit	IE3			=	EXF0^1;
//	sbit	IE2			=	EXF0^0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xF0 bit addressable
	sbit	B_7			=	B^7;	// 	Standard 8051
	sbit	B_6			=	B^6;	// 	Standard 8051
	sbit	B_5			=	B^5;	// 	Standard 8051
	sbit	B_4			=	B^4;	// 	Standard 8051
	sbit	B_3			=	B^3;	// 	Standard 8051
	sbit	B_2			=	B^2;	// 	Standard 8051
	sbit	B_1			=	B^1;	// 	Standard 8051
	sbit	B_0			=	B^0;	// 	Standard 8051
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~0xF8 bit addressable
	sbit	SPEN		=	SPSTA^7;//	(Reserved)
	sbit	SPIF		=	SPSTA^6;//	(Reserved)
	sbit	MODF		=	SPSTA^5;//	(Reserved)
	sbit	WCOL		=	SPSTA^4;//	(Reserved)
	sbit	RXOV		=	SPSTA^3;//	(Reserved)
	
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)
	//sbit				=			//	(Reserved)	
//SFR FINISHED HERE
